import React, { Component } from 'react'
import { Button } from 'antd';
import './App.css'
import { mainRouter } from './routes'
import { Route, Switch, Redirect, Link } from 'react-router-dom'

import Frame from './components/content/frame/Frame'


export default class App extends Component {
  render() {
    return (
      <Frame mainRouter={mainRouter} >

        <Switch>
          {
            mainRouter.map(item => {
              return item.children.map(children => {
                return (
                  <Route path={children.pathname} render={() => {
                    return <children.component />
                  }} key={children.pathname} />
                )
              })
            })
          }
          <Redirect to={'/admin/dashboard'} from={'/admin'}></Redirect>

        </Switch>
      </Frame>

    )
  }
}